import Vue from 'vue'
import App from './App.vue'
import router from './router'
import axios  from 'axios'
//导入富文本编辑器
import VueQuillEditor from 'vue-quill-editor'
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)

// 导入全局样式
import './assets/css/global.css'

//导入tree型插件完成cate页面table数据的渲染
import TreeTable from 'vue-table-with-tree-grid'
//导入字体图标css
import './assets/icfont/font/iconfont.css'
import './plugins/element.js'
// 把axios 挂载在 vue的原型上
axios.defaults.baseURL='https://lianghj.top:8888/api/private/v1/'
// 设置请求拦截器 目的是给请求头添加一个Token
axios.interceptors.request.use(config =>{
    config.headers.Authorization = window.sessionStorage.getItem('token')
    return config
})
Vue.prototype.$http = axios


Vue.config.productionTip = false

//注册全局的时间过滤器
Vue.filter('dateFormat',function(oldtime){
  const dt =  new Date(oldtime)
  const y = dt.getFullYear()
  const m = (dt.getMonth()+1+'').padStart(2,'0')
  const d = (dt.getDate()+'').padStart(2,'0')
  const hh = (dt.getHours()+'').padStart(2,'0')
  const mm = (dt.getMinutes()+'').padStart(2,'0')
  const ss = (dt.getSeconds()+'').padStart(2,'0')
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`

})
//注册导入的Tree型插件
Vue.component('tree-table',TreeTable)
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
